Creation Workshop X Guide
*************************

Creation Workshop X (CW/X) is a modified version of Creation Workshop version
1.0.0.75, the last version of Creation Workshop (CW) that was released under
the Creative Commons Non-Commercial Share-Alike license. Creation Workshop X
is therefore also released under that same license.

Changes are mostly about usability, particularly with the Wanhao Duplicator 7
DLP printer.

CONTENTS
========

1 Enhancement Overview
  A list describing the significant changes from CW 1.0.0.75.
   
2 Installation Notes <- READ THIS SECTION
  Instructions on installing and setting CW/X up for first use.

3 Updating your own previous profiles
  Instructions for transferring profiles you may already have with CW 1.0.0.75

4 Description of CW/X Slicing Profile Settings
  A walk-through of what each of the settings do and why you might tweak them.

5 Advanced GCode
  Notes if you want to do clever stuff beyond what can be done with the
  simple slicing parameters in the tool.

6 Dynamic Configuration
  Notes on using the advanced GCode capabilities to have variable slice
  configuration across a model.

7 Masks
  A warning about the use of masks, and how it can slow down slicing
  significantly.

8 Anti-aliasing
  Explanation for why the anti-aliasing feature is disabled by default.


1 Enhancement Overview
======================

 * The screensaver and sleep functions are automatically inhibited during
   printing, and the Aero "peek" of the printer screen (the hover view on
   the task bar) is disabled completely. These modifications prevent some
   of the most common ways that prints accidentally fail.

 * The Calibration feature supports saving its images to a scene file,
   so the calibration model can be printed e.g. with the Wanhao D7 Box, or
   on the D7 Plus, without a PC attached to the printer. It also now works
   similarly to normal slicing, with a progress bar.
   
 * Masks are now applied during slicing, instead of only on display
   during printing. This means that .CWS files have masked images, and
   so masks apply when using the D7 Box.

 * Loading of ASCII STLs now works.

 * Various usability enhancements; "autocalc" is removed as now unnecessary,
   tooltips added to make it clearer what each setting does, improvements to
   avoid common configuration mistakes when using the D7 Box, warning on
   mismatched mask image size.

 * All GCode is generated from templates, specifically including the
   code for the slice display (the "Layer" GCode). This gives you full
   control over the generated GCode, which makes it possible to generate
   more reliable print sequences, particularly when <slice> takes more
   than negligible time.

 * Added "@" as a pre-processor symbol to refer to user parameters.
   Note that arithmetic does not work with these.
 
 * Introduction of a new pseudo-command in the print sequence, "<Takes>".
   This can be used to tell the print time estimator how long a movement
   will take, if you're using "G4 P0" to wait for a movement command to
   finish instead of just waiting for a bit with "<Delay>".

 * Introduction of new variable SLICESIZE; the size of the current slice
   in mm^2. May be useful for dynamic configuration.

 * Activated the GUI customisation feature, for the adventurous. By default,
   CW/X will generate the traditional blue theme. An example GuiConfig XML
   file is included in honour of Kermit.

 * Some crashes have been fixed, and also a nasty memory leak that
   gobbled up memory when loading and unloading models, and adding supports.

   
2 Installation Notes
====================

This package is a complete application directory. Just unzip it to your
Documents area (it needs to write to files in its own directory, so don't
put it in Program Files), and run Creation Workshop X.exe. Drag the ".exe"
from inside the folder to a blank bit of your task bar to get a quick
startup link.

If you already have an installation of Creation Workshop 1.0.0.75 (or
earlier version of CW/X for that matter), you can leave that alone, it
won't conflict with the new directory and indeed you can continue to
use it as before if for some reason you wish to.

When starting CW/X for the first time from a fresh unzip, first set the
machine configuration:

1) Click "Configure" on the top line

2) Click the drop-down menu "NullMachine" and pick one of:

   Wanhao D7 - PC Display 2
   Wanhao D7 - PC Display 3
   Wanhao D7 - D7 Box

depending on whether you connect your printer to your PC and use CW/X to
control the printer, or you connect your printer to the D7 Box.
For PC control, pick the "Display 2" configuration if you the D7 is
the second display in the Windows display settings; pick "Display 3"
if you have two monitors and the D7 is the third display.
The D7 Box configuration should also be good for the D7 Plus.

Then set the slicing profile for the resin that you are using. Click "Slicing
Profile" then the Machine Profile drop-down and select a profile set, then
click the "Resin" drop-down to select a particular configuration.

Earl Miller's pre-configured slicing profiles are included for several popular
resins at various layer heights. Also included is a profile with the published
settings that Bluecast advised for their specialist resin.


3 Updating your own previous profiles
=====================================

Easy method
-----------

If you have profiles from previous versions that you'd like to transfer
over, it's safest to create a new profile in CW/X and then adjust the various
settings to match. Don't copy old profile files over, as they will have
GCode that will fail with CW/X.

Click the "+" under Machine Profile, and it will populate a default profile
with the GCode settings that work for CW/X. Then adjust all the slicing
settings to match your old profile.

The new settings that don't have equivalents in the the older versions
are Blank Time, Top Time, and Settle Time. To get the same behaviour as
Creation Workshop 1.0.0.75, set Blank Time and Top Time to 0, and set
Settle Time to 1600. See below for a detailed description of what these
settings do.

Advanced method
---------------

If you have a lot of profiles, the easy method can be quite tedious. However
the profiles are just text files that can be edited directly if you are
proficient with a text editor (not MS Word!) and understand XML.

Copy the original profile XML file across to the CW/X Profiles directory, and
make the following changes:

  * Set <BlankTime> to 0
  * Add <TopTime> with value 0
  * Add <SettleTime> with value 1600
  * Copy the <GCodeHeader> up to and including <GCodeLayer> sections
    from a CW/X profile, to replace the same sections

I also check and fix the <DotsPermmX/Y> and <X/YResolution> data, however
CW/X overrides these from the machine configuration anyway


4 Description of CW/X Slicing Profile Settings
==============================================

There are some additional slicing settings available in CW/X compared to
the original Creation Workshop 1.0.0.75. These have also made it possible
to eliminate the "AutoCalc" thing that Creation Workshop did, which just
made it more confusing than it needed to be.

To help understand all the settings, below is a description of how the
print job proceeds, and where and how each setting has an effect.


Layer Exposure
--------------

A print job is performed as a series of layers (or slices). Each layer is
exposed to the UV light in turn, gradually building up the print.

The thickness of all layers is set by the "Layer Thickness" setting. This
is typically between 0.020 and 0.100mm (20um to 100um).

Each layer (apart from the first few layers) is exposed to UV for the amount
of time in the "Exposure Time" setting.

The first few layers can be set to use a different exposure time. Usually
a long exposure for the first few layers is needed to get the print to
stick to the build plate. The lower layers are exposed for the time set in
the "Bottom Exposure" setting, and you can choose how many of these layers
there are with the "# Bottom Layers" setting.


Print Sequence
--------------

Between each layer exposure, the build plate is raised then lowered to place
it ready for the next layer exposure. There are several settings that affect
the speed and timing of this sequence, and they are listed on the right of the
slicing profile in the order they take effect.

After layer exposure, the printer will wait for "Blank time" milliseconds with
the display blanked, before starting to lift the build plate. This allows the
resin curing reaction for the exposed layer to stop neatly before the build
plate moves.

Next, the build plate is lifted (raised) by the "Z Lift Distance", at the speed
set by the "Z Lift Speed" setting. The first few layers can be set to lift at
a different speed using the "Z Bottom Speed" setting - a low value here helps
the first few layers to stick to the build plate instead of the FEP film at
the bottom of the vat.

When the build plate reaches the top of its lift distance, it stays still for
the time set by the "Top Time" setting. This wait time can be useful to give
the resin in the vat more time to flow back under the lifted print.

The build plate is then retracted (lowered) at the speed given by the
"Z Retract Speed" setting, into position to expose the next layer.

Lastly, the build plate is held steady for "Settle Time" before the next layer
is exposed. This gives the resin time to stop moving before the exposure.


User parameters
---------------

There are some additional machine settings that are configured as user parameters.
These are pre-configured correctly for the two Wanhao D7 machine configuration
profiles, but left unset on the null/default machine configurations:

cmdOpenShutter  - printer GCode sequence that switches on the UV
cmdCloseShutter - printer GCode sequence that switches on the UV
cmdPausePrint   - printer GCode sequence sent when a print is paused
cmdResumePrint  - printer GCode sequence sent when a print is resumed
cmdCancelPrint  - printer GCode sequence sent when a print is cancelled


5 Advanced GCode
================

A lot of the above behaviour is caused by the text in the GCode sections.
The default GCode sections are intended to be good for most uses, however
they are completely configurable if you want to do something different.

CW/X assembles the full print sequence by simply appending the sections one
after the other. The Header section is placed first (unsurprisingly), followed
by the Pre-Slice, Layer, and Lift sections once for each layer. Finally the
Footer section is appended to finish the sequence.

CW/X replaces variable names as it goes, much like a mail-merge operation.
The settings in the slicing profile are all assigned variable names which can
be used in the GCode sections however you wish.

Prefix a variable name with "$" and the slicing process will replace it
with its value when it generates the printer GCode. Simple arithmetic can
be performed, and there is also a comparison operation allowing alternatives
to be generated according to the value of a variable. This is most commonly
used to generate different gcode on different layers using the CURSLICE
variable. CURSLICE is the number of the layer - but note it starts at 0 not
1, so is always one less than the layer number shown on the layer view.

A very simple trick is to use CURSLICE to add extra delays for some layers.
For example adding this to the Lift gcode after the ";<Delay> %d$TopTime"
line will add an additional wait time at the top for the first 100 layers:

;{$CURSLICE<100?<Delay> 1000:}

There are a few special commands, which are written with <> brackets. They
include:

  <Slice> - put the numbered slice onto the printer display. The special
            value Blank causes the printer display to be set to all black.
			Note the D7 Box automatically enables the UV array for the
			normal slice command, and automatically disables it for the
			blank slice.

  <Delay> - perform a wait delay of the given whole number of milliseconds

  <Takes> - inform the print time estimator, how long something will take,
            for example a Z move of the build plate. Note that there is a
			special behaviour for the G4 "dwell" printer command, "G4 P0"
			which will wait until any previous movement is complete before
			continuing. It is common to use <Takes> in conjunction with
			"G4 P0" to avoid having to estimate movement times.

The user parameters can also be referred to in the GCode sections in a
similar way to variables by prefixing them with "@". Note however that
arithmetic and comparisons do not work for user parameters.

The "%d" prefix in front of a variable expansion tells CW/X to treat
the result as a whole number - so no decimal point. The above "<>"
commands must be given whole numbers, and "%d" will make that happen.

Lastly, semi-colons mark out "comment" text that is only processed by
the controller (the PC running CW/X, or the D7 Box), and is not sent to
the printer itself. Everything else is sent by the controller to the
printer.


6 Dynamic Configuration
=======================

Michael Laws wrote a guide on using dynamic code in NanoDLP to achieve
variation in the exposure/lift sequence parameters as the print proceeds:

Ref. https://docs.google.com/document/d/1ySVb57AXCVfBFSr9KF7B7k3M130pJvRXXfEoh6pJP_4/edit

These techniques can be used for many things, but in particular they can be
used to minimise print time without compromising print quality. More on this
later, in the example.

First though, a word of caution. Dynamic configuration in CW/X (and CW)
involves modifying the GCode templates. It is *extremely* easy to get this
wrong, and waste lots of resin with print failures.

CW/X already has (from its original Creation Workshop base) the capability
to do complex things with the print sequence through the use of conditional
expressions in the GCode templates. In addition, CW/X adds a SLICESIZE
variable, which is the area in square millimetres of exposed area of the
current slice, calculated by CW/X. Note that this variable is only calculated
if "Enable Slice Size Calculation" is set, as it can add significant time to
the slicing operation, which is unnecessary if SLICESIZE is not being used.

By way of example, consider the lift sequence through out the print job.
When the print job starts, the build plate is very close to the FEP in the
bottom of the vat. So for the first few mm of a model, it is harder work than
usual for the resin to flow back under the plate and for it to help separate
the model from the FEP. Once the build plate is higher, there is usually a
lot more space for resin to move around, and little work for it to do to flow
back into the space made from the model separating from the FEP.

There are many ways to alter the timing. Let's say we decide that for most
of the model, a 4mm lift is plenty to separate the model from the FEP, but
for the lowest 10mm we would like the lift height to be 6mm.

The default lift sequence generated by CW/X, and provided in the included
profiles is as follows:


G1 Z($ZLiftDist * $ZDir) F{$CURSLICE < $NumFirstLayers?$ZBottomLiftRate:$ZLiftRate}
;<Takes> {$CURSLICE<$NumFirstLayers?%d($ZLiftDist*1000*60/$ZBottomLiftRate):%d($ZLiftDist*1000*60/$ZLiftRate)}
G4 P0            ; Wait for lift rise to complete
;<Delay> %d$TopTime
G1 Z(($LayerThickness-$ZLiftDist) * $ZDir) F$ZRetractRate
;<Takes> %d(($ZLiftDist*1000-$LayerThickness*1000)*60/$ZRetractRate)


We could set the slicing profile to have a 4mm lift, then we can add to this
layer template some conditional code that is only included for the lowest
10mm using conditional code and the CURSLICE variable. Here's one solution:


G1 Z($ZLiftDist * $ZDir) F{$CURSLICE < $NumFirstLayers?$ZBottomLiftRate:$ZLiftRate}
;<Takes> {$CURSLICE<$NumFirstLayers?%d($ZLiftDist*1000*60/$ZBottomLiftRate):%d($ZLiftDist*1000*60/$ZLiftRate)}
{$CURSLICE<250?G1 Z2.0 F$ZBottomLiftRate:;}
{$CURSLICE<250?;<Takes> %d(2000*60/$ZBottomLiftRate):;}
G4 P0            ; Wait for lift rise to complete
;<Delay> %d$TopTime
{$CURSLICE<250?G1 Z-2.0 F$ZRetractRate:;}
{$CURSLICE<250?;<Takes> %d(2000*60/$ZRetractRate):;}
G1 Z(($LayerThickness-$ZLiftDist) * $ZDir) F$ZRetractRate
;<Takes> %d(($ZLiftDist*1000-$LayerThickness*1000)*60/$ZRetractRate)


There are four new lines here. Hopefully it's clear that what they do is
do an additional 2mm lift and retract for the layers up to 10mm in height,
and tell the slicer how long each additional movement will take. Aside -
the condition can't include calculations, hence the explicit 250 value in
this example (calculated from an example 40um layer height).

To check the effect, run the slicer, then switch to the Slice View and review
the GCode that has been generated. For this example, the early layers have
the additional four commands so that the Layer sequence might look like this:


;********** Layer 6 ********
;<Slice> 6
M106 S255  ; UV on
;<Delay> 5000
M106 S0 ; UV off
;<Slice> Blank
;<Delay> 1000
G1 Z6.0 F40.0
;<Takes> 9000
G1 Z2.0 F25.0
;<Takes> 4800
G4 P0            ; Wait for lift rise to complete
;<Delay> 1000
G1 Z-2.0 F80.0
;<Takes> 1500
G1 Z-5.96 F80.0
;<Takes> 4470


The later layers, above 10mm (e.g. from layer 250 @ 40um), have blank lines in
place of the additional commands, e.g.


;********** Layer 250 ********
;<Slice> 250
M106 S255  ; UV on
;<Delay> 5000
M106 S0 ; UV off
;<Slice> Blank
;<Delay> 1000
G1 Z6.0 F40.0
;<Takes> 9000
;
;
G4 P0            ; Wait for lift rise to complete
;<Delay> 1000
;
;
G1 Z-5.96 F80.0
;<Takes> 4470


So that's a simple example. A word of caution, however - template processing is
somewhat idiosyncratic, and often doesn't do what you might expect. It is also
very easy to write something that creates incorrect GCode.

Always review what is generated by looking through the Slice View GCode tab.
Then dry-run the sequence to check if it works properly, before committing
expensive resin to your handiwork.


7 Masks
=======

One of the key capabilities that have been added to CW/X, is the ability to
apply the mask to calibration models, and for the mask effect to be visible in
the slice view.

However please note that applying the mask is computationally expensive
(at least the way it is done here) - it involves multiplying each pixel of
each slice image by the intensity of the corresponding pixel in the mask.
Since the slice and mask images are large (2560 x 1440 is over 3.5 million
pixels), this multiplication is a significant amount of work for the computer.

When slicing a model, CW/X gives you the counter to show progress - it should
achieve perhaps one layer a second.

For the calibration model, however, there is no counter to show progress,
and you just have to trust it and wait. As the calibration model is 7mm high,
at 50um that's 140 layers so be prepared to wait several minutes.


8 Anti-aliasing
===============

The Anti-Aliasing option is disabled by default, as too many people were using
it thinking it did one thing, when in practice it doesn't achieve what most
people think it achieves. However the function can be re-enabled in
File->Preferences if you really want to - be sure you understand what it does
however as careless use of it can make quite a mess.

Most people believe that anti-aliasing will give them higher resolution
prints; after all that's what you get with your high-power gaming rig.

However that's not what this does. When you enable anti-aliasing, it
slices to a higher resolution (by multiplying by the display size by the
scale you give it), then down-scales to the display resolution using a
bi-cubic interpolation of the result. Sounds impressive - it has fancy
mathematics in it, after all.

Here is a write-up of some research by smart people at Autodesk on some clever
tricks they pulled using sub-voxel aliasing to get their resin printer to
create better results:

https://3dprint.com/144817/dlp-sub-pixel-resolution/

Now, it would be wonderful if the anti-aliasing feature did this for you.
Unfortunately it doesn't, not even slightly. At best it blurs the surfaces
of your models - more often it just makes a mess in my experience. Here are
a couple of key explanations why it is not predictable:

* Anti-aliasing in CW is applied in-layer to a slice image. It doesn't
  make any attempt to account for the layers either side of it. It's a
  a 2D function - but the sub-voxel aliasing that the Autodesk team did
  was very much a 3D function.

* The anti-aliasing algorithm does that fancy-sounding interpolation which
  mathematically smooths the grey transitions from white to black. This may
  look good on the screen, but it takes absolutely no account of the fact
  the UV intensity is highly non-linear. A pixel at 128 intensity, i.e. half
  way between white and black, does not lead to half the UV strength getting
  through the LCD - not even slightly close.
  Similarly it takes no account of the properties of the resin - which again
  are non-linear, in different ways to the LCD, and different between each
  type of resin.

In summary, the result of applying anti-aliasing is wildly unpredictable.
Indeed it will most likely lead to partially-cured resin left in the vat
mixed in with uncured resin.

Having said all that, it's not my place to prevent you from using the
anti-aliasing function if you really want to. If you don't care about
dimensional accuracy (and for figurines people often don't), some people
like the blurring that it causes around the edges of the slices to get
a smoother (albeit more inaccurate) result. Be prepared to experiment a lot.


